﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClassLibrary;
using System.Configuration;
using System.IO;

namespace OmegapointWeb
{
    public partial class upload : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnUploadImage_Click(object sender, EventArgs e)
        {

            //Stream inputStream = Request.InputStream;
            //string FilePath = string.Format("{0}{1}.{2}", ConfigurationManager.AppSettings["ImagesDir"].ToString(), g, FileUpload.PostedFile.ContentType);
            //FileStream fileStream = new FileStream(FilePath, FileMode.OpenOrCreate);
            //inputStream.CopyTo(fileStream);
            //fileStream.Close();

            //try
            //{
            //    Guid g = Guid.NewGuid();
            //    LogWriter.Print("SessionSingleton.Singleton.WebUserGuid is null ? " + (SessionSingleton.Singleton.WebUserGuid == null), LogLevel.DEBUG);
            //    LogWriter.Print("guid is null ? " + (g == null), LogLevel.DEBUG);
            //    LogWriter.Print("ImagesDir is null ? " + (ConfigurationManager.AppSettings["ImagesDir"] == null), LogLevel.DEBUG);
            //    LogWriter.Print("FileUpload.PostedFile.ContentType is null ? " + (FileUpload.PostedFile.ContentType == null), LogLevel.DEBUG);
            //    string FilePath = string.Format("{0}{1}.{2}", ConfigurationManager.AppSettings["ImagesDir"].ToString(), g, FileUpload.PostedFile.ContentType);
            //    FileUpload.PostedFile.SaveAs(FilePath);
            //    LogWriter.Print("Saving the new ImageData as " + FilePath, LogLevel.LOG);
            //    ImageDataController.CreateEmptyImageData(g, SessionSingleton.Singleton.WebUserGuid, ConfigurationManager.AppSettings["ImagesDir"].ToString());
            //}
            //catch (Exception exc)
            //{
            //    LogWriter.Print("Exception upload->UploadImage_Click() " + exc, LogLevel.EXCEPTION);
            //}
        }
    }
}